<?php
/**
 * Description of MySQL
 *
 * @author Alan Tello Oyola
 * 
 */
require_once 'globales.inc.php';
class MySQL extends mysqli
{
    private $server = DB_HOST;
    //private $server = 'localhost';
    private $usuario = DB_USER;
    private $contrasenia = DB_PASS;
    private $puerto = '';
    private $basedatos = DB_BD;
    // Contenedor Instancia de la Clase
    private static $instance;
    public function __construct()
    {
        parent::__construct($this->server, $this->usuario, $this->contrasenia, $this->basedatos);
        $this->query('SET NAMES UTF8');
    }

    // EL metodo singleton
    public static function singleton()
    {
        if (!isset(self::$instance)) {
            $c = __CLASS__;
            self::$instance = new $c;
        }

        return self::$instance;
    }
    // Clone no permitido
    public function __clone()
    {
        trigger_error('Clone no se permite.', E_USER_ERROR);
    }
}
?>
